import request from '../utils/request';

export const fetchData = query => {
    return request({
        url: './table.json',
        method: 'get',
        params: query
    });
};

export const login = (data) => request({
    url: `/api/user/login.do`,
    method: "post",
    params: data
})

// 主页统计接口
export const home = () => request({
    url: `/api/statistic/base_count.do`,
    method: "get",
})
// 用户管理接口
export const user = (data) => request({
    url: `/api/user/list.do`,
    method: "post",
    params: data
})

//商品管理
export const goods = (data) => request({
    url: `/api/product/list.do`,
    method: "get",
    params: data
})

//商品搜索
export const search = (data) => request({
    url: `/api/product/search.do`,
    method: "get",
    params: data
})

// 商品添加
export const addsave = (form) => request({
    url: `/api/product/save.do`,
    method: "post",
    params: form
})

export const updatesave = (form) => request({
    url: `/api/product/save.do`,
    method: "post",
    params: form
})


//上架，下架
export const upstatus = (data) => request({
    url: `/api//product/set_sale_status.do`,
    method: "get",
    params: data,
})

// 商品详情
export const checkdetails = (data) => request({
    url: `/api/product/detail.do`,
    method: "get",
    params: data
})

// 一级 二级
export const getcategory = (data) => request({
    url: `/api/category/get_category.do`,
    method: "get",
    params: data
})
// 品类管理
export const Pcategory = (data) => request({
    url: `/api/category/get_category.do`,
    method: "get",
    params: data
})
// 品类管理添加
export const addcategory = (data) => request({
    url: `/api/category/add_category.do`,
    method: "get",
    params: data
})
// 品类管理修改
export const updatacategory = (data) => request({
    url: `/api/category/set_category_name.do`,
    method: "get",
    params: data
})

// 订单管理
export const order = (data) => request({
    url: `/api/order/list.do`,
    method: "get",
    params: data
})
// 订单查询
export const ordersearch = (data) => request({
    url: `/api/order/search.do`,
    method: "get",
    params: data
})
// 订单详情
export const Orderdetail = (data) => request({
    url: `/api/order/detail.do`,
    method: "get",
    params: data
})
